<template>
    <!--首页财鑫商苑 教辅资料-->
    <div class="product-contain">
        <div class="product-header">
            <h4>四大学院</h4>
            <p>美国管理会计师的简称，美国财会领域的国际三大黄</p>
            <button @click="goUrl">查看更多</button>
        </div>
        <ul class="product-intro-list">
            <li
                class="live-intro"
                v-for="product in productList"
                :key="product.id"
            >
                <div class="intro-back">
                    <img @click="goPay(product)" :src="product.fengmian_pic_url" alt=""/>
                </div>
                <div class="intro-msg">
                    <div class="intro-title">{{ product.name }}</div>
                    <div class="intro-item">
                        <span v-if="product.tag1">{{ product.tag1 }}</span>
                        <span v-if="product.tag2">{{ product.tag2 }}</span>
                        <span v-if="product.tag3">{{ product.tag3 }}</span>
                    </div>

                    <div class="intro-price">
                        <p class="price-discount">
                            <span>￥</span>
                            <b class="price-num">{{ product.one_price | fixNumber }}</b>
                            /年
                        </p>
                        <p class="price-origin">{{ product.price | fixNumber }}</p>
                    </div>

                </div>
                <div class="intro-buy" @click="goPay(product)">
                    <span>立即购买</span>
                </div>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    name: 'productSchoolView',
    components: {
        /**/
    },
    data() {
        return {
            account: '',
            productList: []
        };
    },
    watch: {
        /**/
    },
    mounted() {
        /**/
        this.doGetGoodsF()
    },
    methods: {
        goUrl() {
            this.$router.replace({
                name: 'courseCenter'
            })
        },
        /**/
        doGetGoodsF() {
            this.$api.ajaxData({
                pathName: 'doGetGoodsF'
            }).then(data => {
                this.productList = data.obj
            })
        },
        goPay(course) {
            let routeData = this.$router.resolve({name: 'landingPage', query: {id: course.id}});
            window.open(routeData.href, '_blank');
        }
    }
};
</script>
<style scoped lang="scss">
.product-contain {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-right: 10px;

    .product-header {
        padding: 15px 10%;
        background: rgba(118, 180, 217, 1);
        color: #fff;
        border-top-right-radius: 10px;
        border-top-left-radius: 10px;

        h4 {
            line-height: 48px;
            margin-bottom: 10px;
            font-size: 28px;
            font-weight: bold;
            text-align: center;
            white-space: nowrap;
            color: #fff;
        }

        p {
            margin: 0 0 20px 0;
            font-size: 14px;
            text-align: center;
        }

        button {
            display: block;
            width: 120px;
            height: 40px;
            margin: 0 auto;
            border-radius: 20px;
            font-size: 13px;
            color: rgba(118, 180, 217, 1);
            background: #fff;
        }
    }

    .product-intro-list {
        display: flex;
        flex: 1;
        margin: 0;
        border: 1px solid rgba(242, 242, 242, 1);

        li {
            flex: 1;
            background: #fff;
            position: relative;

            .intro-back {
                position: relative;
                margin: 15px 15px 10px;
                padding-top: 50%;
                background: rgba(0, 0, 0, 0.1);

                img {
                    position: absolute;
                    top: 0;
                    left: 0;
                    display: block;
                    width: 100%;
                    height: 100%;
                }
            }

            .intro-msg {
                position: relative;

                .intro-title {
                    padding-left: 20px;
                    font-size: 14px;
                    color: #333;
                }

                .intro-item {
                    display: flex;
                    flex-wrap: wrap;
                    padding: 10px 10px 0 15px;
                    line-height: 14px;
                    font-size: 12px;
                    color: #ccc;

                    span {
                        display: block;
                        padding: 1px 5px;
                        margin-right: 5px;
                        margin-bottom: 5px;
                        border-radius: 5px;
                        border: 1px solid #ccc;
                    }
                }

                .intro-price {
                    height: 60px;
                    padding: 0 15px;

                    .price-discount {
                        line-height: 30px;
                        margin: 0;
                        font-size: 14px;
                        color: rgb(102, 102, 102);

                        span {
                            color: rgb(255, 106, 0);
                        }

                        b {
                            font-size: 18px;
                            color: rgb(255, 106, 0);
                        }
                    }

                    .price-origin {
                        font-size: 12px;
                        color: rgb(204, 204, 204);
                        text-decoration: line-through;
                    }
                }

            }

            .intro-buy {
                display: none;
                position: absolute;
                bottom: 0;
                height: 60px;
                width: 100%;
                line-height: 60px;
                font-size: 16px;
                color: #fff;
                background: #ff6a00;
                text-align: center;
                cursor: pointer;
            }

            &:hover {
                .intro-buy {
                    display: block;
                    position: absolute;
                    bottom: 0;
                    height: 60px;
                    width: 100%;
                    line-height: 60px;
                    font-size: 16px;
                    color: #fff;
                    background: #ff6a00;
                    text-align: center;
                    cursor: pointer;
                }
            }

            &:not(:first-child) {
                border-left: 1px solid rgba(242, 242, 242, 1);
            }
        }
    }
}
</style>
